#include "clean/test/TestSpectrumProcessing.h"
#include "clean/SpectrumProcessing.h"

#include <iostream>
#include <vector>

using namespace spectClean;

/**
 * @details
 */
void TestSpectrumProcessing::test()
{
    typedef SpectrumComponent fc;

    SpectrumProcessing sp;
    TimeSeries t;
    Spectrum s;

    const unsigned num_times = 500;
    const double tStart = 0.0;
    const double tEnd = 2.0;
    std::vector<fc> components;
    components.push_back(fc(1.0, 5.0));
    components.push_back(fc(0.1, 20.0));

    t.generateEven(num_times, tStart, tEnd, components);
    sp.dirtySpectrumDFT(t, s, 50.0, 20);

//    t.save("test_times.txt");
//    s.save("test_spectrum.txt");
}


void TestSpectrumProcessing::test_psf()
{
    typedef SpectrumComponent fc;
    SpectrumProcessing sp;

    TimeSeries t;
    std::vector<fc> components;
    components.push_back(fc(1.0, 5.0));
    components.push_back(fc(0.1, 20.0));
    t.generateRandom(100, 0.0, 2.0, components);

    Spectrum ds;
    sp.dirtySpectrumDFT(t, ds, 30.0, 10);

    Spectrum ws;
    sp.windowSpectrumDFT(t, ws, 60.0, 20);

//    t.save("test_psf_times.txt");
//    ds.save("test_psf_dirty.txt");
//    ws.save("test_psf_window.txt");
}

